#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
using namespace std;
int last=0;
vector<int>tran(int num)
{
	vector<int> a;
	while (num > 0)
	{
		a.push_back(num%2);
		num =num/2;
		
	}

	return a;
}
int judge(vector<int> &a)
{
	int last = 0;
	for (int i = 0; i < a.size(); i++)
	{
		if (a[i] == 1) last = i;
	}
	return last;
}
int main()
{
	int n = 0;
	cin >> n;
	int num = 0;
	vector<int> a;
	for (int i = 0; i < n; i++)
	{
		cin >> num;
		a = tran(num);
		
		for (int j = 0;j<a.size();j++)
		{
			int last=judge(a);
			if (a[j] == 1)
			{
				if (j != last)
					cout << j << ' ';
				else cout << j;
			}
		}
		cout << endl;
	}
	return 0;
}